<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" session="false" %>
<html lang="zh-CN">

<head>

<title>应用下载</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <meta name="renderer" content="webkit">
    <meta name="viewport"
	content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <meta name="copyright" content="杭州掌连信息科技有限公司"/>
	<meta name="author" content="杭州掌连信息科技有限公司-软件组"/>  
	<link href="${pageContext.request.contextPath}/static/plugins/layer_mobile/need/layer.css" rel="stylesheet">
	<link href="${pageContext.request.contextPath}/static/css/appstore.css" rel="stylesheet">
	 <script src="${pageContext.request.contextPath}/static/js/jquery-1.11.3.min.js"></script>
<script src="${pageContext.request.contextPath}/static/plugins/layer_mobile/layer.js"></script>
<style>
* { margin: 0; padding: 0;}
 html, body, #wrap {height: 100%;}
 body { font: 16px/1.8 "Microsoft Yahei",verdana;}

.download-button{
	height: 3rem;
	line-height:3rem;
	width: 87%;
	margin-left: auto;
	margin-right: auto;
	font-size: 1.2rem;
	background-color: #333333;
	color: #ffffff;
	text-align:center;
	/* padding-left: 1rem; */
	border:1px  #b5b5b5;
	-moz-border-radius: 2px; 
    -webkit-border-radius: 2px; 
    border-radius:2px; 
    margin-top: 4rem;
}
.os_logo{
	height: 1.8rem;
	position: relative;
	top: 0.3rem;
}
#iphone-downlaod{
	display: none;
}
#android-downlaod{
	display: none;
}
.banner {
    width: 100%;
}
/* #buttom_div{
	position: relative;
	bottom: 0;
	overflow: hidden;
} */
.bottom{
	width: 100%;
	position:absolute;
	bottom: 0;
}
.separator1{
	border-top:solid 1px #333333;width: 87%;
	margin: 0 auto;
	margin-top: 1rem;
}
#banner_div{
}
#buttom1{
	overflow: hidden;
	margin-top: 1rem;
}
</style>
</head>

<body class="download_main_lock">  
	<div id="banner_div">
		<img alt="" src="${bannerImgUrl}" class="banner">
	</div>
	<div id="iphone-downlaod" class="iphone-downlaod download-button"  onclick="downLoad()">
		<img alt="" src="${pageContext.request.contextPath}/static/images/admin/appstore/ios.png" class="os_logo">IOS下载
	</div>
	<div id="android-downlaod" class="android-downlaod download-button"  onclick="downLoad()">
		<img alt="" src="${pageContext.request.contextPath}/static/images/admin/appstore/android.png" class="os_logo">	Android下载
	</div>
	<div class="separator1"></div>
	<div id='buttom1'>
		<div style="position: relative;height: 100%">
			<img alt="" src="${bottomImgUrl}" class="bottom">
		</div>
	</div>
</body> 
<script>
	var iosUrl = '${iosAppDownload}';
	var wxzUrl="${wxzUrl}";//http://a.app.qq.com/o/simple.jsp?pkgname=com.blzx.zhihuibao
	var androidId="${androidId}";
	var androidUrl="${androidUrl}";
	var isIos = navigator.appVersion.match(/(iphone | ipad | ipod)/gi);
	$(document).ready(function() {
		if (isIos) {
			$("#iphone-downlaod").show();
			if(isWeixin()){//微信浏览器需要跳转微下载地址
				if(wxzUrl.indexOf("http")>-1){
					window.location.href = wxzUrl;	
				}else{
					
					showMsg("请点击右上角,在'safari'中打开");
				}
			}else{
				if(iosUrl.indexOf("http")>-1){
					window.location.href = iosUrl;
				}else{
					showMsg("未设置ios地址，请联系管理员或在app store中搜索下载");
				}
			}
			
			
		} else {
			$("#android-downlaod").show();
		}
		
		var height = $(window).height();
		var top = $("#buttom1").offset().top;
		var minHeight=200;
		if((top+minHeight)>height){
			$("#buttom1").height(minHeight);
		}else{
			$("#buttom1").height(height-top);
		}
	})

	function downLoad() {
		if (isIos) {
			if(isWeixin()){//微信浏览器需要跳转微下载地址
				if(wxzUrl.indexOf("http")>-1){
					window.location.href = wxzUrl;	
				}else{
					showMsg("请点击右上角,在'safari'中打开");
				}
			}else{
				if(iosUrl.indexOf("http")>-1){
					window.location.href = iosUrl;
				}else{
					showMsg("未设置ios地址，请联系管理员或在app store中搜索下载");
				}
			}
		} else {
			if(androidUrl==""){
				showMsg("未设置android地址，请联系管理员或在应用商店中搜索下载");
			}else{
				//window.location.href = "${pageContext.request.contextPath}/admin/appstore_downloadApp.action?sid=${sid}";				
				window.location.href = androidUrl;
			}
		}
	}
	function isWeixin(){
		var ua = navigator.userAgent.toLowerCase();
		if(ua.match(/MicroMessenger/i)=="micromessenger") {
			return true;
	 	} else {
			return false;
		}
	}
	
	function showMsg(content){
		layer.open({
		    content:content,
		    time:2
		});
	}
</script>
</body>
</html>